home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / net / bind-contrib.tar.gz / bind-contrib.tar / contrib / doc / doc3.awk < prev    next >
Text File  |  1996-10-25  |  774b  |  34 lines

  1. #
  2. # doc3.awk
  3. #
  4. #      Distributed with:  Doc - Version 2.0 (8/22/90)
  5. #      USC Information Sciences Institute
  6. #
  7. # Accepts as input, output from dig querying for NS records of a
  8. # domain.  Expects input to include TTLs and to be all lower case.
  9. #
  10. # Prints list of machines which are nameserves for the domain.
  11. # Also crunches following info into the 8 bit unix exit code:
  12. #
  13. #    o response was authoritative (or not)
  14. #    o number of unique TTLs associated with NS records
  15. #    o number of A records found for domain names found to be servers
  16. #
  17.  
  18. BEGIN {aa=0; glue=0; ttl=0}
  19.  
  20. /flags:/ && /aa/ {aa++}
  21.  
  22. $4=="ns" {print $5; a[$5]=1; if (zttl[$2]++ == 0) ttl++}
  23. $4=="a" {if (a[$1]++ == 1) glue++}
  24.  
  25. END {
  26.   j = glue;
  27.   j = j + 16 * ttl;
  28.  
  29.   if (aa)
  30.      j = j - 127;
  31.  
  32.    exit(j)
  33. }
  34.